_init: function(sourceActor, styleClass) {
this.sourceActor = sourceActor;
+ this._parent = null;
if (styleClass !== undefined) {
this.box = new St.BoxLayout({ style_class: styleClass,
this._sessionUpdatedId = Main.sessionMode.connect('updated', Lang.bind(this, this._sessionUpdated));
},
+ _getTopMenu: function() {
+ if (this._parent)
+ return this._parent._getTopMenu();
+ else
+ return this;
+ },
+
_sessionUpdated: function() {
this._setSettingsVisibility(Main.sessionMode.allowSettings);
},
else
throw TypeError("Invalid argument to PopupMenuBase.addMenuItem()");
+ menuItem._parent = this;
+
this.length++;
},
this.actor.hide();
},
- _getTopMenu: function() {
- let actor = this.actor.get_parent();
- while (actor) {
- if (actor._delegate && actor._delegate instanceof PopupMenu)
- return actor._delegate;
-
- actor = actor.get_parent();
- }
-
- return null;
- },
-
_needsScrollbar: function() {
let topMenu = this._getTopMenu();
let [topMinHeight, topNaturalHeight] = topMenu.actor.get_preferred_height(-1);